﻿using System;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;

namespace MiniSched.Orm.Enumerations {

    public abstract class EnumEntityOption {

        internal EnumEntityOption(string name) {
            _Name = name;
        }

        public string Name { get { return _Name; } }
        private readonly string _Name;
    }

    public abstract class EnumEntityOption<TEntity> : EnumEntityOption where TEntity : EnumEntity {

        internal EnumEntityOption(string name) : base(name) { }
    }

    public abstract class EnumEntityOption<TEntity, TOption> : EnumEntityOption<TEntity>
        where TEntity : EnumEntity
        where TOption : EnumEntityOption 
    {

        internal EnumEntityOption(string name) : base(name) { }

        public static IEnumerable<TOption> Values {
            get {
                return typeof(TOption)
                    .GetProperties(BindingFlags.Public | BindingFlags.Static)
                    .Select(p => p.GetValue(null, null))
                    .OfType<TOption>();
            }
        }
    }
}
